@extends("pdf.layouts.default_pdf")

@section("title", "订单")

@section("css")
    .field {
        margin-bottom: .75rem;
    }
    .order-items th,
    .order-items td{
        text-align: right;
        padding-bottom:.75rem;
    }
@endsection

@section("body")
    <h2>订单号 {{ $order->order_number }}</h2>
    <hr/>
    <div class="w-100" style="font-size: 0">
        <div class="left w-50 d-inline-block text-size-normal vertical-align-top">
            <div class="field">
                <label class="d-block">客户</label>
                <span class="d-block">{{$order->customer->name}}</span>
            </div>

            <div class="field">
                <label class="d-block">预期租借开始日期</label>
                <span class="d-block">{{$order->expected_rental_out_date}}</span>
            </div>

            <div class="field">
                <label class="d-block">折扣</label>
                <span class="d-block">{{$order->discount}}</span>
            </div>

        </div>


        <div class="right w-50 d-inline-block text-size-normal vertical-align-top">
            <div class="field">
                <label class="d-block">创建日期</label>
                <span class="d-block">{{$order->created_at->format('Y-m-d')}}</span>
            </div>

            <div class="field">
                <label class="d-block">预期归还日期</label>
                <span class="d-block">{{$order->expected_return_date}}</span>
            </div>

        </div>
    </div>

    <h2>清单</h2>
    <hr/>
    <table class="w-100 order-items" cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <th>物品名称</th>
                <th>单价</th>
                <th>数量</th>
                <th>价格</th>
            </tr>

        </thead>
        <tbody>
            @foreach ($items as $item)
                <tr>
                    <td> {{$item->name}}</td>
                    <td> {{$item->unit_price}}</td>
                    <td> {{$item->quantity}}</td>
                    <td> {{$item->amount}}</td>
                </tr>
            @endforeach
        </tbody>
        <tfoot>
            <tr>
                <td></td>
                <td></td>
                <td style="border-top: 1px dotted">总价</td>
                <td style="border-top: 1px dotted">{{$order->net_amount}}</td>
            </tr>

        </tfoot>
    </table>

@endsection
